package com.example.lvsuo.service.impl;

import com.example.lvsuo.entity.vo.ZcVo;
import com.example.lvsuo.service.IZcService;
import com.example.lvsuo.entity.Zc;
import com.example.lvsuo.mapper.ZcMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 心心念念
 * @since 2021-03-30
 */
@Service
@Transactional
public class ZcServiceImpl extends ServiceImpl<ZcMapper, Zc> implements IZcService {

    @Autowired
    ZcMapper zm;

    @Override
    public PageInfo queryZc(ZcVo z) {
        if(z.getPageNum()==null){
            z.setPageNum(1);
        }
        if(z.getPageSize()==null){
            z.setPageSize(5);
        }
        PageHelper.startPage(z.getPageNum(),z.getPageSize());
        return new PageInfo(zm.queryJc(z));
    }
}
